Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

[CHINF-886][MS] Fixing a crash caused by the merge into release related to the jira issue. #1864

Merged

Conversation

MatthewSandfordImprobable
Copy link
Collaborator

@MatthewSandfordImprobable MatthewSandfordImprobable commented Mar 4, 2020

Contributions: We are not currently taking public contributions - see our contributions policy. However, we are accepting issues and we do want your feedback.


Description

Previously we got the PlayInEditorID inside ConnectToReceptionist by trying to get the NetDriver and take it off that. Issue with that is that the Example project was making the SpatialWorkerConnection->Connect call before PendingNetGame was set resulting in a crash.

USpatialNetDriver* USpatialWorkerConnection::GetSpatialNetDriverChecked() const
{
UNetDriver* NetDriver = GameInstance->GetWorld()->GetNetDriver();

// On the client, the world might not be completely set up.
// in this case we can use the PendingNetGame to get the NetDriver
if (NetDriver == nullptr)
{
	NetDriver = GameInstance->GetWorldContext()->**PendingNetGame**->GetNetDriver();
}

USpatialNetDriver* SpatialNetDriver = Cast<USpatialNetDriver>(NetDriver);
checkf(SpatialNetDriver, TEXT("SpatialNetDriver was invalid while accessing SpatialNetDriver!"));
return SpatialNetDriver;

}

@improbable-prow-robot
Copy link

Corresponding JIRA ticket: https://improbableio.atlassian.net/browse/CHINF-886

@improbable-prow-robot improbable-prow-robot added jira/CHINF size/S Denotes a PR that changes 15-39 lines, ignoring generated files. labels Mar 4, 2020
@MatthewSandfordImprobable MatthewSandfordImprobable changed the title [CHINF-886][MS] Fixing a crash caused by the merge into release relat… [CHINF-886][MS] Fixing a crash caused by the merge into release related to the jira issue. Mar 4, 2020
@@ -45,7 +45,7 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable
/// @param Callback - callback function.
void RegisterOnLoginTokensCallback(const LoginTokenResponseCallback& Callback) {LoginTokenResCallback = Callback;}

void Connect(bool bConnectAsClient);
void Connect(bool bConnectAsClient, uint32 PlayInEditorI);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void Connect(bool bConnectAsClient, uint32 PlayInEditorI);
void Connect(bool bConnectAsClient, uint32 PlayInEditorID);

@MatthewSandfordImprobable MatthewSandfordImprobable merged commit 81c2c9a into 0.8.1-preview-rc Mar 4, 2020
@MatthewSandfordImprobable MatthewSandfordImprobable deleted the bugfix/CHINF-886-crash_fix branch March 4, 2020 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jira/CHINF size/S Denotes a PR that changes 15-39 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants